<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%--<%@include file="include.jsp" %>--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="cache.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <title>
            <decorator:title default="Виртуальная лаборатория" />
        </title>

        <link rel="icon" type="image/png" href="img/favicon/weblab.png" />
        <!--[if IE]>
            <link rel="shortcut icon" type="image/x-icon" href="img/favicon/weblab.ico" />
        <![endif]-->

        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <!--[if IE]>
            <link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
        <![endif]-->
        <link rel="stylesheet" type="text/css" href="css/theme.css" />
        <link rel="stylesheet" type="text/css" href="jwysiwyg/jquery.wysiwyg.css" />
        <link rel="stylesheet" type="text/css" href="datatable/css/demo_table_jui.css" />

        <script src="js/jquery.js" type="text/javascript"></script>
        <script src="js/jquery.corners.js" type="text/javascript"></script>
        <script src="jwysiwyg/jquery.wysiwyg.js" type="text/javascript"></script>
        <script src="datatable/jquery.dataTables.js" type="text/javascript"></script>

    </head>
    <body>



        <div id="container">

            <div id="header">
                <div id="top-menu">
                    <div id="account">
                        <c:if test="<%= request.getRemoteUser() != null%>">
                            <ul>
                                <li>
                                    Вы вошли как <a href="Profile" title="Профиль"><%=request.getRemoteUser()%></a>
                                </li>

                                <li>
                                    Роли:
                                    <c:if test='<%=request.isUserInRole("admin")%>'><a href="#">Администратор</a></c:if>
                                    <c:if test='<%=request.isUserInRole("tutor")%>'><a href="#">Тьютор</a></c:if>
                                    <c:if test='<%=request.isUserInRole("student")%>'><a href="#">Студент</a></c:if>

                                    <%--<c:if test='${roles.admin}'><a href="#">Администратор</a></c:if>
                                    <c:if test='${roles.tutor}'><a href="#">Преподаватель</a></c:if>
                                    <c:if test='${roles.student}'><a href="#">Студент</a></c:if>--%>

                                </li>
                                <li>
                                    <a href="LogoutServlet"> Выйти</a>
                                </li>
                            </ul>
                        </c:if>
                    </div>
                </div>
                <h2><a href="./" style="color: white; text-decoration: none;">Виртуальная лаборатория</a></h2>

                <div id="topmenu">
                    <%@include file="topmenu.jsp" %>
                </div>
            </div>
            <div id="top-panel">
                <p style="text-indent: 8px; float: left"></p>
                <a style="float: right; padding-left: 23px; margin-top: 2px; margin-right: 3px;" href="javascript:" class="zoom_in" id="expander" onclick="expand();">Развернуть</a>
                <a style="float: right; padding-left: 23px; margin-top: 2px; margin-right: 3px;" href="javascript:" class="zoom_out" id="expander" onclick="expand();">Свернуть</a>
            </div>

            <div id="wrapper">
                <div id="content" class="rounded">
                    <decorator:body />
                </div>
                <%@include file="sidebar.jsp" %>
            </div>

            <div id="footer" class="rounded">
                <!-- <div id="credits">&copy; 2010 <a href="http://miitlearn.ru">MIIT-Expert</a></div> -->
                <div id="credits">Илья Чиликин &copy; 2010 "Виртуальная лаборатория"</div>
                <div id="styleswitcher">
                    <ul>
                        <li><a
                                href="javascript: document.cookie='theme='; window.location.reload();"
                                title="Mix" id="mixswitch">m</a></li>
                        <li><a
                                href="javascript: document.cookie='theme=4'; window.location.reload();"
                                title="Default" id="defswitch">d</a></li>

                        <li><a
                                href="javascript: document.cookie='theme=1'; window.location.reload();"
                                title="Blue" id="blueswitch">b</a></li>
                        <li><a
                                href="javascript: document.cookie='theme=2'; window.location.reload();"
                                title="Green" id="greenswitch">g</a></li>
                        <li><a
                                href="javascript: document.cookie='theme=3'; window.location.reload();"
                                title="Brown" id="brownswitch">b</a></li>

                    </ul>
                </div>
                <br />
            </div>
        </div>
        <script type="text/javascript">
            try {
                var themeCookies;
                if(document.cookie != null
                    && ( (themeCookies = document.cookie.split("theme=")) != null
                    && themeCookies.length > 0) ) {
                    var themeNum = themeCookies[1].charAt(0);
                    var StyleFile = "theme" + (themeNum == ";" ? "" : themeNum) + ".css";
                    document.writeln('<link rel="stylesheet" type="text/css" href="css/' + StyleFile + '"/>');
                } else {
                    document.writeln('<link rel="stylesheet" type="text/css" href="css/theme.css"/>');
                }
            } catch(e){}
        </script>

        <script type="text/javascript">
            try {
                var expand;
                if(document.cookie != null
                    && ( (expand = document.cookie.split("expandws=")) != null
                    && expand.length > 0) ) {
                    var toExp = expand[1].charAt(0);
                    if(toExp == 'y') {
                        // alert('toExp == "y"');
                        document.writeln('<link rel="stylesheet" type="text/css" href="css/style_expanded.css"/>');
                    }
                }
            } catch(e){}
        </script>

        <script type="text/javascript">
            function doDatatable(tableId) {
                $('#'+tableId).dataTable( {
                    // "sPaginationType": "full_numbers",

                    "oLanguage": {
                        // "sUrl": "datatable/dataTables.russian.txt"
                        // *
                        "sLengthMenu": "Показывать _MENU_ записей на странице",
                        "sZeroRecords": "Нет записей",
                        "sInfo": "Показано _START_ - _END_ записей из _TOTAL_",
                        "sInfoEmtpy": "Нет записей",
                        "sInfoFiltered": "(выбрано из _MAX_ записей)",
                        "sSearch": "Фильтр"
                        // */
                    }
                    , "bSort": false

                } );

                $('#'+tableId+'_length').css("width", "35%");
                $('#'+tableId+'_filter').css("width", "60%");

                $('#'+tableId+'_wrapper').css("margin-top", "4px");
                $('#'+tableId+'_length').css("margin-left", "5px");
                $('#'+tableId+'_filter').css("margin-right", "10px");
                $('#'+tableId+'_info').css("margin-left", "4px");
                $('#'+tableId+'_paginate').css("margin-right", "10px");
                $('#'+tableId+'_paginate').css("margin-bottom", "4px");

                if($.browser.opera || $.browser.webkit) {
                    $('#'+tableId).css('width', '98%');
                }

            <%--try{
                pageSpecificDatatable(tableId);
            }catch(e){}--%>
                }
        </script>

        <script type="text/javascript">
            function quickSearchSubmit() {
                var f = document.searchform;
                var q = f.q.value;
                if(q != null) {
                    if(q.length > 2) {
                        f.submit();
                    } else {
                        alert('Поиск ведётся минимум по трём символам');
                    }
                }
            }
        </script>

        <script type="text/javascript">
            $(document).ready(function(){
                try { /* corners */
                    if(!$.browser.msie) {
                        $('.rounded').corner();
                        $('.rounded-top').corner('top');

                        $('form.rounded-formcascade').corner();
                        $('form.rounded-formcascade > fieldset').corner();
                        $('form.rounded-formcascade > fieldset > legend').corner();

                        $('div.rounded-divcascade').corner();
                        $('div.rounded-divcascade > div#rightnow').corner('top');
                        $('div.rounded-divcascade > h3.reallynow').corner('top');
                        $('div.rounded-divcascade > div#rightnow > h3.reallynow').corner('top');
                    

                        //$(".current > a").corner('top');
                        $('div#top-panel').corner('bottom');
                        $('div#top-panel').corner('right');

                        //$('.uncorner').uncorner();
                    } else {
                        // OMG YOUR BROWSER IS IE!
                        $('div#content').corner();
                        $('div#sidebar').corner();
                        $('div#footer').corner();
                        $('div#top-panel').corner('bottom');
                        $('div#top-panel').corner('right');
                    }
                
                    $("#rightnow .accept").click(function(){
                        $(this).parents("#rightnow").animate({ opacity: 'hide' }, "slow");
                    });
                } catch (e) {/* corners */}


                try { // expander
                    $('a#expander').click(function() {
                        if($('div#sidebar').is(':visible')) {
                            // set cookie and reload
                            document.cookie='expandws=y';
                            window.location.reload();
                        } else {
                            // remove cookie and reload
                            document.cookie='expandws=n';
                            window.location.reload();
                        }
                    });
                } catch(e) {} // /expander
                
                try { // jwysiwyg
                    $('.goWysiwyg').click(function() {
                        if($.browser.msie) {
                            $('.taWysiwyg').css('height', '144px');
                        }
                        $('textarea.taWysiwyg').wysiwyg({
                            controls : {
                                increaseFontSize  : { visible : true }
                                , decreaseFontSize  : { visible : true }
                            }
                        });
                        $('a.goWysiwyg').remove();
                                
                        try {
                            pageSpecificWysiwyg();
                        } catch (e) {}
                    });
                } catch(e){}// / jwysiwyg



                try { /*opera style*/
                    if($.browser.opera) {
                        $('div#topmenu').css('margin-top', '33px');
                    }
                } catch (e) {/*opera style*/}
            });
        </script>

    </body>
</html>
